<?php
class MeituController extends ApiController{
	
	public function actionList(){
		$datas = new HayApiDatabase();
		$datas->Tablename='news';
		$datas->Array=array(
			'imageHeight'=>'imageHeight',
			'imageID'=>'id',
			'imageURL'=>'cover',
			'imageWidth '=>'imageWidth'
		);
		$datas->LastId = isset($_GET['lastID'])?$_GET['lastID']:'0';
		$datas->Limit = isset($_GET['number'])?$_GET['number']:'10';
		$datas->Field = 'cate_id';
		$datas->Bool = true;
		return $datas->JsonDatas();
		
	}
	public function actionList2(){
		$model = new News();
		$criteria = new CDbCriteria();
		$criteria->condition ='cate_id=17';
		$model = $model->findAll($criteria);
		$arraynew = array();
		$arraynew['code']=1;
		if (!empty($model)){
		foreach ($model as $value){
			$arr =array();
			$arr['imageHeight'] = CHtml::value($value, 'imageHeight');
			$arr['imageID'] = CHtml::value($value, 'id');
			$arr['imageURL'] = CHtml::value($value, 'cover');
			$arr['imageWidth'] = CHtml::value($value, 'imageWidth');
			
			$arraynew['data'][]= $arr;
		}
		echo json_encode($arraynew);
		}else {
			$array =array(
				'code'=>0,
				'msg'=>'表数据为空',
			);
			echo json_encode($array);
		}
	}
}